<include file="Inc/header" />
<div class="margin10px">
	<form name="addpage" method="post" action="<?php echo U('admin/acl/group_add');?>" onsubmit="return checkNode();">
		<table class="mytable">
			<tr>
				<th colspan="2">添加分组</th>
			</tr>
            <tr>
                <td width="100" class="tdf">所属分组：</td>
                <td><?php echo $groups;?></td>
            </tr>
			<tr>
				<td width="100" class="tdf">分组名称：</td>
				<td><input type="text" id="group_name" name="group_name" size="40" /><span></span></td>
			</tr>
			<tr>
				<td class="tdf" valign="top">分组权限：</td>
				<td>
                	<div class="node_list">
                        <?php if($nodes)foreach($nodes as $k=>$v){?>
                        <div><input class="cb" type="checkbox" name="auth[]" id="n_<?php echo $v['node_id'];?>" value="<?php echo $v['node_id'];?>"><label for="n_<?php echo $v['node_id'];?>" class="color_0 fb f14"><?php echo $v['node_name'];?></label>
                            <?php if($v['_sub'])foreach($v['_sub'] as $vv){?>
                                <div class="mleft30px"><input class="cb" type="checkbox" name="auth[]" id="n_<?php echo $vv['node_id'];?>" value="<?php echo $vv['node_id'];?>" /><label for="n_<?php echo $vv['node_id'];?>" class="fb"><?php echo $vv['node_name'];?></label>
                                    <div class="mleft60px bd1sccc">
                                        <?php if($vv['_sub'])foreach($vv['_sub'] as $vvv){?>
                                        <input type="checkbox" name="auth[]" id="n_<?php echo $vvv['node_id'];?>" value="<?php echo $vvv['node_id'];?>" /><label for="n_<?php echo $vvv['node_id'];?>"><?php echo $vvv['node_name'];?></label>&nbsp;&nbsp;&nbsp;
                                        <?php }?>
                                    </div>
                                </div>
                            <?php }?>
                        </div>
                        <?php }?>
                    </div>
                </td>
			</tr>
			<tr>
				<td class="tdf">&nbsp;</td>
				<td><input type="checkbox" id="cka" onclick="checkAll(this, 'auth[]')" />全选&nbsp;&nbsp;&nbsp;<input type="submit" name="formsubmit" value="添加" class="button" /></td>
			</tr>
		</table>
	</form>
</div>
<script type="text/javascript">
    $('.cb').click(function(){
        var flag = false;
        if($(this).attr('checked')){ flag = true; }
        $(this).parent().find('input[type="checkbox"]').attr('checked', flag);
    });
	//检查表单
	function checkNode(){
		if($.trim($('#group_name').val())==''){
			$('#group_name').css('background-color','#ffc');
			$('#group_name').next('span').html('<font color=red> 分组名称不能为空</font>');
			$('#group_name').focus();
			return false;
		}
	}
</script>
<include file="Inc/footer" />